#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int n, a, b;
bool flag = false;

void bfs(vector<int> &k, vector<int> &v) {
    queue<int> q;
    v[a] = 0;
    q.push(a);
    while (!q.empty()) {
        int front = q.front();
        int layer = v[front];
        q.pop();
        for(int i=0; i<2; i++) {
            int next = front;
            if(!i)  next += k[front];
            else    next -= k[front];
            if(!v[next] && next>=1 && next<=n) {
                v[next] = layer + 1;
                q.push(next);
                if(next == b) {
                    flag = true;
                    cout << v[next] << endl;
                    return;
                }
            }
        }
    }
}

int main() {
    cin >> n >> a >> b;
    if(a == b) { // 特判
        cout << 0 << endl;
        return 0;
    }
    vector<int> k(n+5, 0);
    vector<int> v(n+5, 0);
    for (int i=1; i<=n; i++)
        cin >> k[i];
    bfs(k, v);
    if(!flag)   cout << -1 << endl;
    return 0;
} 